﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TableTool.Model;

namespace TableTool
{
    public partial class udLookModelEdit : UserControl
    {
        public LookModel lookModel { get; set; }
        public event Action<LookModel> Edit;
        public event Action<LookModel> Delete;
        public udLookModelEdit()
        {
            InitializeComponent();
            this.Load += UdLookModelEdit_Load;
        }

        private void UdLookModelEdit_Load(object? sender, EventArgs e)
        {
            if (lookModel != null)
            {
                label1.Text = lookModel.groupName;
                label2.Text = lookModel.Name;
                label3.Text = lookModel.timeSecond.ToString();
            }

        }
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            Edit?.Invoke(lookModel);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            Delete?.Invoke(lookModel);
        }
    }
}
